package com.nicy.molly.biz;

import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 获取接口信息
 * @projectName:molly
 * @see:com.nicy.molly.biz
 * @author:NicyYe
 * @createTime:2021/3/10 16:17
 * @version:1.0
 */
@RestController
@RequestMapping("/getUniRest")
public class UniRestController {

    @GetMapping("/token")
    public String getToken(){
        HttpResponse<JsonNode> response = Unirest.post("http://localhost:8999/rest/getToken")
                .header("accept","application/json")
                .queryString("apiKey","4cb49276-9bde-47f0-9b72-f833f650c617")
                .field("foo","bar")
                .asJson();
        response.getBody();
        System.out.println(response.getBody());
        System.out.println(response.getHeaders());
        return null;
    }


}
